

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Weaver - LiterateCS</title>

	<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
    <link rel="stylesheet" href="../bootstrap/css/readable/bootstrap.min.css" />
<link rel="stylesheet" href="../font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../sidebar/sidebar.min.css" />
<link rel="stylesheet" href="../css/book.min.css" />
<link rel="stylesheet" href="../syntax-highlight/solarized-light.min.css" />
<link rel="stylesheet" href="../mermaid/mermaid.css" />

</head>

<body>
    
    <nav class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#sidebar-toggle" id="sidebar-toggle">
					<span>
						<img src="../images/favicon.ico" height="24" class="hidden-sm hidden-xs" />
						<i id="sidebar-toggle-icon" class="hidden-md hidden-lg hidden-xl fa fa-angle-double-right" aria-hidden="true"></i>
						LiterateCS
					</span>
				</a>
            </div>
            <div id="navbar" class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li><a href="../index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></li>
					<li><a href="https://github.com/johtela/LiterateCS"><i class="fa fa-github" aria-hidden="true"></i> GitHub Repository</a></li>
                    <li><a href="https://www.nuget.org/packages/LiterateCS/"><i class="fa fa-download" aria-hidden="true"></i> Download</a></li>
                    <li><a href="../License.html">License</a></li>
                </ul>
            </div>
        </div>
    </nav>

    <div class="container">
        <div class="row">
            <div id="sidebar" class="col-md-3 hidden-sm hidden-xs">
                
        <div class="panel panel-default">
            <div class="panel-heading">
                <h4>On This Page</h4>
            </div>
            <div id="header-menu" class="panel-body main-menu">
                <ul></ul>
            </div>
        </div>  
        <div class="panel panel-default">
            <div class="panel-heading">
                <h4>Table of Contents</h4>
            </div>
            <div class="panel-body main-menu">
                <ul>
	<li><a href="../index.html">Home</a></li>
	<ul>
	</ul>
	<li><a href="../Introduction.html">Introduction</a></li>
	<ul>
	</ul>
	<li><a href="../LiterateCS/Options.html">Command Line Options</a></li>
	<ul>
	</ul>
	<li><a href="../LiterateCS/Program.html">Main Program</a></li>
	<ul>
	</ul>
	<li><a href="../LiterateCS/SplitPath.html">SplitPath Structure</a></li>
	<ul>
	</ul>
	<li><a href="../LiterateCS/Weaver.html" class="selected">Document Weaver</a></li>
	<ul>
	</ul>
	<li><a href="../LiterateCS/MdWeaver.html">Markdown Weaver</a></li>
	<ul>
	</ul>
	<li><a href="../LiterateCS/HtmlWeaver.html">HTML Weaver</a></li>
	<ul>
	</ul>
	<li><a href="../LiterateCS/TocManager.html">TOC Manager</a></li>
	<ul>
	</ul>
	<li><a href="../LiterateCS/BlockList.html">Source Blocks</a></li>
	<ul>
	</ul>
	<li><a href="../LiterateCS/Macro.html">Macros</a></li>
	<ul>
	</ul>
	<li><a href="../LiterateCS/BlockBuilder.html">Block Builder</a></li>
	<ul>
	</ul>
	<li><a href="../LiterateCS/HtmlBlockBuilder.html">HTML Block Builder</a></li>
	<ul>
	</ul>
	<li><a href="../LiterateCS/HtmlGenerator.html">HTML Generation</a></li>
	<ul>
	</ul>
	<li>Themes</li>
	<ul>
<ul>
	<li><a href="../LiterateCS.Theme/DirHelpers.html">Directory Utilities</a></li>
	<ul>
	</ul>
	<li><a href="../LiterateCS.Theme/Toc.html">Table of Contents Classes</a></li>
	<ul>
	</ul>
	<li><a href="../LiterateCS.Theme/PageParams.html">Page Parameters</a></li>
	<ul>
	</ul>
	<li><a href="../LiterateCS.Theme/Theme.html">Theme Base Class</a></li>
	<ul>
	</ul>
	<li><a href="../LiterateCS.Theme/LiterateException.html">Reporting Errors</a></li>
	<ul>
	</ul>
</ul>
	</ul>
	<li><a href="../FrontMatter.html">Front Matter</a></li>
	<ul>
	</ul>
	<li><a href="../TableOfContents.html">Table of Contents File</a></li>
	<ul>
	</ul>
	<li><a href="../TipsAndTricks.html">Tips &amp; Tricks</a></li>
	<ul>
	</ul>
	<li><a href="../License.html">License</a></li>
	<ul>
	</ul>
	<li><a href="../README.html">README</a></li>
	<ul>
	</ul>
	<li><a href="../Installation.html">Installation</a></li>
	<ul>
	</ul>
</ul>
            </div>
        </div>

            </div>
			<div id="contentarea" class="col-md-9 col-sm-12 col-sm-push-0 col-xs-12 col-xs-push-0">
				<ul class="pager">
	<li class="previous"><a href="../LiterateCS/SplitPath.html">Previous: SplitPath Structure</a></li>
	<li class="next"><a href="../LiterateCS/MdWeaver.html">Next: Markdown Weaver</a></li>
</ul>
				<div id="static-content" class="markdown">
					<h1 id="document-weaver">Document Weaver</h1>
<p>The main workhorse of the application is the weaver. It enumerates the source
files as specified in the command line options and generates documentation for
each file separately.</p>
<p>The Weaver class is abstract, and the actual documentation generation is
delegated to its subclasses. There are two subclasses for the two output
formats: <a href="MdWeaver.html">MdWeaver</a> for markdown and <a href="HtmlWeaver.html">HtmlWeaver</a>
for HTML.</p>
<p>Let's first look at the base class which contains code common to both weavers.</p>
<h2 id="dependencies">Dependencies</h2>
<p>We utilize a couple of libraries to compile and analyze C# code. The first one is
the <a href="https://github.com/dotnet/roslyn">Roslyn</a> compiler platform. Assemblies related to
it lay under the <code>Microsoft.CodeAnalysis.*</code> namespace.</p>
<p>The other libarary we depend on is <a href="https://github.com/daveaglick/Buildalyzer">Buildalyzer</a>
which helps loading and build msbuild projects. Quite a lot of scaffolding is needed
to configure Roslyn to compile
<a href="https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-reference">MSBuild</a>
projects correctly. Buildalyzer simplifies this task immensely and allows us to ignore
the details with respect to different kinds of MSBuild projects.</p>
<pre class="csharp"><code class="csharp"><span class="keyword" id="LiterateCS">namespace</span> LiterateCS
<span class="punctuation">{</span>
	<span class="keyword">using</span> LiterateCS<span class="punctuation">.</span>Theme<span class="punctuation">;</span>
	<span class="keyword">using</span> Microsoft<span class="punctuation">.</span>CodeAnalysis<span class="punctuation">;</span>
	<span class="keyword">using</span> Buildalyzer<span class="punctuation">;</span>
	<span class="keyword">using</span> Buildalyzer<span class="punctuation">.</span>Workspaces<span class="punctuation">;</span>
	<span class="keyword">using</span> System<span class="punctuation">;</span>
	<span class="keyword">using</span> System<span class="punctuation">.</span>Collections<span class="punctuation">.</span>Generic<span class="punctuation">;</span>
	<span class="keyword">using</span> System<span class="punctuation">.</span>IO<span class="punctuation">;</span>
	<span class="keyword">using</span> System<span class="punctuation">.</span>Linq<span class="punctuation">;</span>
	<span class="keyword">using</span> System<span class="punctuation">.</span>Text<span class="punctuation">.</span>RegularExpressions<span class="punctuation">;</span>

	<span class="keyword" id="LiterateCS.Weaver">public</span> <span class="keyword">abstract</span> <span class="keyword">class</span> <span class="typename">Weaver</span>
	<span class="punctuation">{</span>
</code></pre>
<h2 id="creating-a-weaver">Creating a Weaver</h2>
<p>When creating a weaver the selected command line options must be passed to it.</p>
<pre class="csharp"><code class="csharp">		<span class="keyword">protected</span> <span class="typename" data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Options.html#LiterateCS.Options">Options</a></span> <span id="LiterateCS.Weaver._options">_options</span><span class="punctuation">;</span>

		<span class="keyword" id="LiterateCS.Weaver.Weaver(LiterateCS.Options)" data-toggle="tooltip" title="LiterateCS.Weaver.Weaver(LiterateCS.Options)">public</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.Weaver(LiterateCS.Options)">Weaver</span> <span class="punctuation">(</span><span class="typename" data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Options.html#LiterateCS.Options">Options</a></span> options<span class="punctuation">)</span>
		<span class="punctuation">{</span>
			<span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span> <span class="punctuation" data-toggle="tooltip" title="LiterateCS.Options">=</span> <span data-toggle="tooltip" title="LiterateCS.Options">options</span><span class="punctuation">;</span>
		<span class="punctuation">}</span>
</code></pre>
<h2 id="generating-documentation">Generating Documentation</h2>
<p>Weaver can generate documentation from two sources: from a directory or from a
solution. One of the abstract methods below is invoked when the tool is run. Which
one is selected depends on the command line options.</p>
<pre class="csharp"><code class="csharp">		<span class="keyword" id="LiterateCS.Weaver.GenerateFromFiles()" data-toggle="tooltip" title="LiterateCS.Weaver.GenerateFromFiles()">protected</span> <span class="keyword" data-toggle="tooltip" title="LiterateCS.Weaver.GenerateFromFiles()">abstract</span> <span class="keyword" data-toggle="tooltip" title="void">void</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.GenerateFromFiles()">GenerateFromFiles</span> <span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.Weaver.GenerateFromFiles()">;</span>
		<span class="keyword" id="LiterateCS.Weaver.GenerateFromSolution()" data-toggle="tooltip" title="LiterateCS.Weaver.GenerateFromSolution()">protected</span> <span class="keyword" data-toggle="tooltip" title="LiterateCS.Weaver.GenerateFromSolution()">abstract</span> <span class="keyword" data-toggle="tooltip" title="void">void</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.GenerateFromSolution()">GenerateFromSolution</span> <span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.Weaver.GenerateFromSolution()">;</span>
</code></pre>
<p>Another method which the subclasses may override is the CreateBlockBuilder that is
defined	below. This	method will create the <a href="BlockBuilder.html">BlockBuilder</a> class
that is responsible for splitting the input files into blocks. The standard
implementation is sufficient for generating markdown output, but
<a href="HtmlWeaver.html">HtmlWeaver</a> requires more sophisticated functionality provided by
the <a href="HtmlBlockBuilder.html">HtmlBlockBuilder</a> class.</p>
<pre class="csharp"><code class="csharp">		<span class="keyword" id="LiterateCS.Weaver.CreateBlockBuilder()" data-toggle="tooltip" title="LiterateCS.Weaver.CreateBlockBuilder()">protected</span> <span class="keyword" data-toggle="tooltip" title="LiterateCS.Weaver.CreateBlockBuilder()">virtual</span> <span class="typename" data-toggle="tooltip" title="LiterateCS.BlockBuilder"><a href="../LiterateCS/BlockBuilder.html#LiterateCS.BlockBuilder">BlockBuilder</a></span> <span data-toggle="tooltip" title="LiterateCS.Weaver.CreateBlockBuilder()">CreateBlockBuilder</span> <span class="punctuation">(</span><span class="punctuation">)</span>
		<span class="punctuation">{</span>
			<span class="keyword">return</span> <span class="keyword" data-toggle="tooltip" title="LiterateCS.BlockBuilder">new</span> <span class="typename"><a href="../LiterateCS/BlockBuilder.html#LiterateCS.BlockBuilder">BlockBuilder</a></span> <span class="punctuation">(</span><span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation">)</span><span class="punctuation">;</span>
		<span class="punctuation">}</span>
</code></pre>
<h3 id="main-documentation-generation-method">Main Documentation Generation Method</h3>
<p>Main program will call the method below to run the document generation. The method
determines whether the files are read from a solution or from an input folder. Based
on the options it will call the appropriate virtual method.</p>
<pre class="csharp"><code class="csharp">		<span class="keyword" id="LiterateCS.Weaver.GenerateDocumentation()" data-toggle="tooltip" title="LiterateCS.Weaver.GenerateDocumentation()">public</span> <span class="keyword" data-toggle="tooltip" title="void">void</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.GenerateDocumentation()">GenerateDocumentation</span> <span class="punctuation">(</span><span class="punctuation">)</span>
		<span class="punctuation">{</span>
			<span class="keyword">if</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/Options.html#LiterateCS.Options.Solution">Solution</a></span> <span class="punctuation" data-toggle="tooltip" title="bool">!=</span> <span class="keyword">null</span><span class="punctuation">)</span>
			<span class="punctuation">{</span>
				<span data-toggle="tooltip" title="LiterateCS.Weaver.ConsoleOut(string, params object[])"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.ConsoleOut(string, object[])">ConsoleOut</a></span> <span class="punctuation">(</span><span class="string" data-toggle="tooltip" title="string">&quot;Creating documentation for solution: {0}&quot;</span><span class="punctuation">,</span> 
					<span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/Options.html#LiterateCS.Options.Solution">Solution</a></span><span class="punctuation">)</span><span class="punctuation">;</span>
				<span data-toggle="tooltip" title="LiterateCS.Weaver.GenerateFromSolution()"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.GenerateFromSolution()">GenerateFromSolution</a></span> <span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span>
			<span class="punctuation">}</span>
			<span class="keyword">else</span>
			<span class="punctuation">{</span>
				<span data-toggle="tooltip" title="LiterateCS.Weaver.ConsoleOut(string, params object[])"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.ConsoleOut(string, object[])">ConsoleOut</a></span> <span class="punctuation">(</span><span class="string" data-toggle="tooltip" title="string">&quot;Creating documentation for files in directory: {0}&quot;</span><span class="punctuation">,</span> 
					<span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/Options.html#LiterateCS.Options.InputFolder">InputFolder</a></span><span class="punctuation">)</span><span class="punctuation">;</span>
				<span data-toggle="tooltip" title="LiterateCS.Weaver.GenerateFromFiles()"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.GenerateFromFiles()">GenerateFromFiles</a></span> <span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span>
			<span class="punctuation">}</span>
			<span data-toggle="tooltip" title="LiterateCS.Weaver.ConsoleOut(string, params object[])"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.ConsoleOut(string, object[])">ConsoleOut</a></span> <span class="punctuation">(</span><span class="string" data-toggle="tooltip" title="string">&quot;Done.&quot;</span><span class="punctuation">)</span><span class="punctuation">;</span>
		<span class="punctuation">}</span>
</code></pre>
<h3 id="verbose-output">Verbose Output</h3>
<p>If verbose mode is active (<code>-v</code> option), information about the progress of
the tool is outputted to the console.</p>
<pre class="csharp"><code class="csharp">		<span class="keyword" id="LiterateCS.Weaver.ConsoleOut(string, object[])" data-toggle="tooltip" title="LiterateCS.Weaver.ConsoleOut(string, params object[])">protected</span> <span class="keyword" data-toggle="tooltip" title="void">void</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.ConsoleOut(string, params object[])">ConsoleOut</span> <span class="punctuation">(</span><span class="keyword" data-toggle="tooltip" title="string">string</span> text<span class="punctuation">,</span> <span class="keyword">params</span> <span class="keyword" data-toggle="tooltip" title="object">object</span><span class="punctuation">[</span><span class="punctuation">]</span> args<span class="punctuation">)</span>
		<span class="punctuation">{</span>
			<span class="keyword">if</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation" data-toggle="tooltip" title="bool">.</span><span data-toggle="tooltip" title="bool"><a href="../LiterateCS/Options.html#LiterateCS.Options.Verbose">Verbose</a></span><span class="punctuation">)</span>
				<span class="typename" data-toggle="tooltip" title="System.Console">Console</span><span class="punctuation" data-toggle="tooltip" title="System.Console.WriteLine(string, params object[])">.</span><span data-toggle="tooltip" title="System.Console.WriteLine(string, params object[])">WriteLine</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="string">text</span><span class="punctuation">,</span> <span data-toggle="tooltip" title="object[]">args</span><span class="punctuation">)</span><span class="punctuation">;</span>
		<span class="punctuation">}</span>
</code></pre>
<h3 id="output-path-for-a-file">Output Path for a File</h3>
<p>For each input file we need to construct the output path. We take the base
path from command line options and join it with the relative file path of
the input file changing the extension simultaneously. We also check that the
output directory exists, and create it when needed.</p>
<pre class="csharp"><code class="csharp">		<span class="keyword" id="LiterateCS.Weaver.CreateOutputPath(LiterateCS.SplitPath, string)" data-toggle="tooltip" title="LiterateCS.Weaver.CreateOutputPath(LiterateCS.SplitPath, string)">protected</span> <span class="typename" data-toggle="tooltip" title="LiterateCS.SplitPath"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath">SplitPath</a></span> <span data-toggle="tooltip" title="LiterateCS.Weaver.CreateOutputPath(LiterateCS.SplitPath, string)">CreateOutputPath</span> <span class="punctuation">(</span><span class="typename" data-toggle="tooltip" title="LiterateCS.SplitPath"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath">SplitPath</a></span> codeFile<span class="punctuation">,</span> <span class="keyword" data-toggle="tooltip" title="string">string</span> extension<span class="punctuation">)</span>
		<span class="punctuation">{</span>
			<span class="keyword" data-toggle="tooltip" title="LiterateCS.SplitPath">var</span> <span id="outputFile">outputFile</span> <span class="punctuation">=</span> <span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.SplitPath">.</span><span data-toggle="tooltip" title="LiterateCS.SplitPath"><a href="../LiterateCS/Options.html#LiterateCS.Options.OutputPath">OutputPath</a></span> <span class="punctuation" data-toggle="tooltip" title="LiterateCS.SplitPath">+</span> <span data-toggle="tooltip" title="LiterateCS.SplitPath">codeFile</span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.SplitPath.ChangeExtension(string)">.</span><span data-toggle="tooltip" title="LiterateCS.SplitPath.ChangeExtension(string)"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath.ChangeExtension(string)">ChangeExtension</a></span> <span class="punctuation">(</span><span data-toggle="tooltip" title="string">extension</span><span class="punctuation">)</span><span class="punctuation">;</span>
			<span data-toggle="tooltip" title="LiterateCS.Weaver.ConsoleOut(string, params object[])"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.ConsoleOut(string, object[])">ConsoleOut</a></span> <span class="punctuation">(</span><span class="string" data-toggle="tooltip" title="string">&quot;Generating {0} from file &#39;{1}&#39; into file &#39;{2}&#39;&quot;</span><span class="punctuation">,</span>
				<span data-toggle="tooltip" title="string">extension</span><span class="punctuation">,</span> <span data-toggle="tooltip" title="LiterateCS.SplitPath">codeFile</span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath.FilePath">FilePath</a></span><span class="punctuation">,</span> <span data-toggle="tooltip" title="LiterateCS.SplitPath">outputFile</span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath.FilePath">FilePath</a></span><span class="punctuation">)</span><span class="punctuation">;</span>
			<span class="typename" data-toggle="tooltip" title="LiterateCS.Theme.DirHelpers"><a href="../LiterateCS.Theme/DirHelpers.html#LiterateCS.Theme.DirHelpers">DirHelpers</a></span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.Theme.DirHelpers.EnsureExists(string)">.</span><span data-toggle="tooltip" title="LiterateCS.Theme.DirHelpers.EnsureExists(string)"><a href="../LiterateCS.Theme/DirHelpers.html#LiterateCS.Theme.DirHelpers.EnsureExists(string)">EnsureExists</a></span> <span class="punctuation">(</span><span data-toggle="tooltip" title="LiterateCS.SplitPath">outputFile</span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath.DirectoryName">DirectoryName</a></span><span class="punctuation">)</span><span class="punctuation">;</span>
			<span class="keyword">return</span> <span data-toggle="tooltip" title="LiterateCS.SplitPath">outputFile</span><span class="punctuation">;</span>
		<span class="punctuation">}</span>
</code></pre>
<h2 id="selecting-input-files">Selecting Input Files</h2>
<p>The subclasses can use the following methods to retrieve paths of he input
files. The methods use LINQ to enumerate the SplitPath structures that refer
to files in a directory or in a solution.</p>
<h3 id="enumerating-files-in-input-folder">Enumerating Files in Input Folder</h3>
<p>First variant returns all the files in the input directory that match the
specified filters. The filters are regular expressions that are constructed
from the glob patterns by the methods shown below.</p>
<pre class="csharp"><code class="csharp">		<span class="keyword" id="LiterateCS.Weaver.FilterRegexes()" data-toggle="tooltip" title="LiterateCS.Weaver.FilterRegexes()">protected</span> <span class="typename" data-toggle="tooltip" title="System.Text.RegularExpressions.Regex">Regex</span><span class="punctuation">[</span><span class="punctuation">]</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.FilterRegexes()">FilterRegexes</span> <span class="punctuation">(</span><span class="punctuation">)</span>
		<span class="punctuation">{</span>
			<span class="keyword">return</span> <span class="punctuation" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Regex>">(</span><span class="keyword">from</span> filt <span class="keyword">in</span> <span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<string>">.</span><span data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<string>"><a href="../LiterateCS/Options.html#LiterateCS.Options.Filters">Filters</a></span>
					<span class="keyword" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Regex>">select</span> <span class="keyword" data-toggle="tooltip" title="System.Text.RegularExpressions.Regex">new</span> <span class="typename">Regex</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="LiterateCS.Weaver.WildcardToRegex(string)"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.WildcardToRegex(string)">WildcardToRegex</a></span> <span class="punctuation">(</span><span data-toggle="tooltip" title="string">filt</span><span class="punctuation">)</span><span class="punctuation">)</span><span class="punctuation" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Regex>">)</span>
				   <span class="punctuation" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Regex>.ToArray<System.Text.RegularExpressions.Regex>()">.</span><span data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Regex>.ToArray<System.Text.RegularExpressions.Regex>()">ToArray</span> <span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span>
		<span class="punctuation">}</span>

		<span class="keyword" id="LiterateCS.Weaver.WildcardToRegex(string)" data-toggle="tooltip" title="LiterateCS.Weaver.WildcardToRegex(string)">protected</span> <span class="keyword" data-toggle="tooltip" title="LiterateCS.Weaver.WildcardToRegex(string)">static</span> <span class="keyword" data-toggle="tooltip" title="string">string</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.WildcardToRegex(string)">WildcardToRegex</span> <span class="punctuation">(</span><span class="keyword" data-toggle="tooltip" title="string">string</span> pattern<span class="punctuation">)</span> <span class="punctuation">=&gt;</span>
			<span class="string" data-toggle="tooltip" title="string">&quot;^&quot;</span> <span class="punctuation" data-toggle="tooltip" title="string">+</span>
			<span class="typename" data-toggle="tooltip" title="System.Text.RegularExpressions.Regex">Regex</span><span class="punctuation" data-toggle="tooltip" title="System.Text.RegularExpressions.Regex.Escape(string)">.</span><span data-toggle="tooltip" title="System.Text.RegularExpressions.Regex.Escape(string)">Escape</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="string">pattern</span><span class="punctuation" data-toggle="tooltip" title="string.Replace(char, char)">.</span><span data-toggle="tooltip" title="string.Replace(char, char)">Replace</span> <span class="punctuation">(</span>
				<span class="typename" data-toggle="tooltip" title="System.IO.Path">Path</span><span class="punctuation" data-toggle="tooltip" title="char">.</span><span data-toggle="tooltip" title="char">DirectorySeparatorChar</span> <span class="punctuation" data-toggle="tooltip" title="bool">==</span> <span data-toggle="tooltip" title="char">&#39;\\&#39;</span> <span class="punctuation" data-toggle="tooltip" title="char">?</span> <span data-toggle="tooltip" title="char">&#39;/&#39;</span> <span class="punctuation" data-toggle="tooltip" title="char">:</span> <span data-toggle="tooltip" title="char">&#39;\\&#39;</span><span class="punctuation">,</span> <span class="typename" data-toggle="tooltip" title="System.IO.Path">Path</span><span class="punctuation" data-toggle="tooltip" title="char">.</span><span data-toggle="tooltip" title="char">DirectorySeparatorChar</span><span class="punctuation">)</span><span class="punctuation">)</span>
			<span class="punctuation" data-toggle="tooltip" title="string.Replace(string, string)">.</span><span data-toggle="tooltip" title="string.Replace(string, string)">Replace</span> <span class="punctuation">(</span><span class="string" data-toggle="tooltip" title="string">@&quot;\*\*&quot;</span><span class="punctuation">,</span> <span class="string" data-toggle="tooltip" title="string">&quot;.*&quot;</span><span class="punctuation">)</span>
			<span class="punctuation" data-toggle="tooltip" title="string.Replace(string, string)">.</span><span data-toggle="tooltip" title="string.Replace(string, string)">Replace</span> <span class="punctuation">(</span><span class="string" data-toggle="tooltip" title="string">@&quot;\*&quot;</span><span class="punctuation">,</span> <span class="string" data-toggle="tooltip" title="string">&quot;[^\\\\/]*&quot;</span><span class="punctuation">)</span>
			<span class="punctuation" data-toggle="tooltip" title="string.Replace(string, string)">.</span><span data-toggle="tooltip" title="string.Replace(string, string)">Replace</span> <span class="punctuation">(</span><span class="string" data-toggle="tooltip" title="string">@&quot;\?&quot;</span><span class="punctuation">,</span> <span class="string" data-toggle="tooltip" title="string">&quot;.&quot;</span><span class="punctuation">)</span>
			<span class="punctuation" data-toggle="tooltip" title="string">+</span> <span class="string" data-toggle="tooltip" title="string">&quot;$&quot;</span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.Weaver.WildcardToRegex(string)">;</span>
</code></pre>
<p>Now we can enumerate the input files.</p>
<pre class="csharp"><code class="csharp">		<span class="keyword" id="LiterateCS.Weaver.InputFiles()" data-toggle="tooltip" title="LiterateCS.Weaver.InputFiles()">protected</span> <span class="typename" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<LiterateCS.SplitPath>">IEnumerable</span><span class="punctuation">&lt;</span><span class="typename" data-toggle="tooltip" title="LiterateCS.SplitPath"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath">SplitPath</a></span><span class="punctuation">&gt;</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.InputFiles()">InputFiles</span> <span class="punctuation">(</span><span class="punctuation">)</span>
		<span class="punctuation">{</span>
			<span class="keyword" data-toggle="tooltip" title="System.Text.RegularExpressions.Regex[]">var</span> <span id="filtRegexes">filtRegexes</span> <span class="punctuation">=</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.FilterRegexes()"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.FilterRegexes()">FilterRegexes</a></span> <span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span>
			<span class="keyword">return</span> <span class="keyword">from</span> file <span class="keyword">in</span> <span class="typename" data-toggle="tooltip" title="LiterateCS.Theme.DirHelpers"><a href="../LiterateCS.Theme/DirHelpers.html#LiterateCS.Theme.DirHelpers">DirHelpers</a></span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.Theme.DirHelpers.Dir(string, string, bool)">.</span><span data-toggle="tooltip" title="LiterateCS.Theme.DirHelpers.Dir(string, string, bool)"><a href="../LiterateCS.Theme/DirHelpers.html#LiterateCS.Theme.DirHelpers.Dir(string, string, bool)">Dir</a></span> <span class="punctuation">(</span><span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.SplitPath">.</span><span data-toggle="tooltip" title="LiterateCS.SplitPath"><a href="../LiterateCS/Options.html#LiterateCS.Options.InputPath">InputPath</a></span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath.BasePath">BasePath</a></span><span class="punctuation">,</span> <span class="string" data-toggle="tooltip" title="string">&quot;*&quot;</span><span class="punctuation">,</span> <span class="keyword" data-toggle="tooltip" title="bool">true</span><span class="punctuation">)</span>
				   <span class="keyword">let</span> relPath <span class="punctuation">=</span> <span class="typename" data-toggle="tooltip" title="LiterateCS.SplitPath"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath">SplitPath</a></span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.SplitPath.Split(string, string)">.</span><span data-toggle="tooltip" title="LiterateCS.SplitPath.Split(string, string)"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath.Split(string, string)">Split</a></span> <span class="punctuation">(</span><span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.SplitPath">.</span><span data-toggle="tooltip" title="LiterateCS.SplitPath"><a href="../LiterateCS/Options.html#LiterateCS.Options.InputPath">InputPath</a></span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath.BasePath">BasePath</a></span><span class="punctuation">,</span> <span data-toggle="tooltip" title="string">file</span><span class="punctuation">)</span>
				   <span class="keyword">where</span> <span data-toggle="tooltip" title="System.Text.RegularExpressions.Regex[]">filtRegexes</span><span class="punctuation" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Regex>.Any<System.Text.RegularExpressions.Regex>(System.Func<System.Text.RegularExpressions.Regex, bool>)">.</span><span data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Regex>.Any<System.Text.RegularExpressions.Regex>(System.Func<System.Text.RegularExpressions.Regex, bool>)">Any</span> <span class="punctuation">(</span>re <span class="punctuation" data-toggle="tooltip" title="lambda expression">=&gt;</span> <span data-toggle="tooltip" title="System.Text.RegularExpressions.Regex">re</span><span class="punctuation" data-toggle="tooltip" title="System.Text.RegularExpressions.Regex.IsMatch(string)">.</span><span data-toggle="tooltip" title="System.Text.RegularExpressions.Regex.IsMatch(string)">IsMatch</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="LiterateCS.SplitPath">relPath</span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath.FilePath">FilePath</a></span><span class="punctuation">)</span><span class="punctuation">)</span>
				   <span class="keyword" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<LiterateCS.SplitPath>">select</span> <span data-toggle="tooltip" title="LiterateCS.SplitPath">relPath</span><span class="punctuation">;</span>
		<span class="punctuation">}</span>
</code></pre>
<p>We define also helpers to enumerate just code or markdown files.</p>
<pre class="csharp"><code class="csharp">		<span class="keyword" id="LiterateCS.Weaver.MarkdownFiles()" data-toggle="tooltip" title="LiterateCS.Weaver.MarkdownFiles()">protected</span> <span class="typename" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<LiterateCS.SplitPath>">IEnumerable</span><span class="punctuation">&lt;</span><span class="typename" data-toggle="tooltip" title="LiterateCS.SplitPath"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath">SplitPath</a></span><span class="punctuation">&gt;</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.MarkdownFiles()">MarkdownFiles</span> <span class="punctuation">(</span><span class="punctuation">)</span>
		<span class="punctuation">{</span>
			<span class="keyword">return</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.InputFiles()"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.InputFiles()">InputFiles</a></span> <span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<LiterateCS.SplitPath>.Where<LiterateCS.SplitPath>(System.Func<LiterateCS.SplitPath, bool>)">.</span><span data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<LiterateCS.SplitPath>.Where<LiterateCS.SplitPath>(System.Func<LiterateCS.SplitPath, bool>)">Where</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="LiterateCS.Weaver.IsMarkdownFile(LiterateCS.SplitPath)"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.IsMarkdownFile(LiterateCS.SplitPath)">IsMarkdownFile</a></span><span class="punctuation">)</span><span class="punctuation">;</span>
		<span class="punctuation">}</span>

		<span class="keyword" id="LiterateCS.Weaver.SourceFiles()" data-toggle="tooltip" title="LiterateCS.Weaver.SourceFiles()">protected</span> <span class="typename" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<LiterateCS.SplitPath>">IEnumerable</span><span class="punctuation">&lt;</span><span class="typename" data-toggle="tooltip" title="LiterateCS.SplitPath"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath">SplitPath</a></span><span class="punctuation">&gt;</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.SourceFiles()">SourceFiles</span> <span class="punctuation">(</span><span class="punctuation">)</span>
		<span class="punctuation">{</span>
			<span class="keyword">return</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.InputFiles()"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.InputFiles()">InputFiles</a></span> <span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<LiterateCS.SplitPath>.Where<LiterateCS.SplitPath>(System.Func<LiterateCS.SplitPath, bool>)">.</span><span data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<LiterateCS.SplitPath>.Where<LiterateCS.SplitPath>(System.Func<LiterateCS.SplitPath, bool>)">Where</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="LiterateCS.Weaver.IsSourceFile(LiterateCS.SplitPath)"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.IsSourceFile(LiterateCS.SplitPath)">IsSourceFile</a></span><span class="punctuation">)</span><span class="punctuation">;</span>
		<span class="punctuation">}</span>
</code></pre>
<h3 id="enumerating-files-in-solution">Enumerating Files in Solution</h3>
<p>When a solution file is used as an input, C# files are retrieved in a different way.
They are enumerated using the Roslyn
<a href="https://github.com/dotnet/roslyn/wiki/Roslyn-Overview#working-with-a-workspace">workspace</a>.</p>
<pre class="csharp"><code class="csharp">		<span class="keyword" id="LiterateCS.Weaver.CSharpDocumentsInSolution()" data-toggle="tooltip" title="LiterateCS.Weaver.CSharpDocumentsInSolution()">protected</span> <span class="typename" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<System.Tuple<LiterateCS.SplitPath, Microsoft.CodeAnalysis.Document>>">IEnumerable</span><span class="punctuation">&lt;</span><span class="typename" data-toggle="tooltip" title="System.Tuple<LiterateCS.SplitPath, Microsoft.CodeAnalysis.Document>">Tuple</span><span class="punctuation">&lt;</span><span class="typename" data-toggle="tooltip" title="LiterateCS.SplitPath"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath">SplitPath</a></span><span class="punctuation">,</span> <span class="typename" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Document">Document</span><span class="punctuation">&gt;</span><span class="punctuation">&gt;</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.CSharpDocumentsInSolution()">CSharpDocumentsInSolution</span> <span class="punctuation">(</span><span class="punctuation">)</span>
		<span class="punctuation">{</span>
			<span class="keyword" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Solution">var</span> <span id="solution">solution</span> <span class="punctuation">=</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.BuildSolution()"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.BuildSolution()">BuildSolution</a></span> <span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span>
			<span class="keyword" data-toggle="tooltip" title="System.Text.RegularExpressions.Regex[]">var</span> filtRegexes <span class="punctuation">=</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.FilterRegexes()"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.FilterRegexes()">FilterRegexes</a></span> <span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span>
			<span class="keyword">return</span> <span class="keyword">from</span> proj <span class="keyword">in</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.CompileProjectsInSolution(Microsoft.CodeAnalysis.Solution)"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.CompileProjectsInSolution(Microsoft.CodeAnalysis.Solution)">CompileProjectsInSolution</a></span> <span class="punctuation">(</span><span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Solution">solution</span><span class="punctuation">)</span>
				   <span class="keyword">from</span> doc <span class="keyword">in</span> <span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project">proj</span><span class="punctuation" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Document>">.</span><span data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Document>">Documents</span>
				   <span class="keyword">let</span> relPath <span class="punctuation">=</span> <span class="typename" data-toggle="tooltip" title="LiterateCS.SplitPath"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath">SplitPath</a></span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.SplitPath.Split(string, string)">.</span><span data-toggle="tooltip" title="LiterateCS.SplitPath.Split(string, string)"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath.Split(string, string)">Split</a></span> <span class="punctuation">(</span><span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.SplitPath">.</span><span data-toggle="tooltip" title="LiterateCS.SplitPath"><a href="../LiterateCS/Options.html#LiterateCS.Options.InputPath">InputPath</a></span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath.BasePath">BasePath</a></span><span class="punctuation">,</span> <span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Document">doc</span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string">FilePath</span><span class="punctuation">)</span>
				   <span class="keyword">where</span> <span data-toggle="tooltip" title="System.Text.RegularExpressions.Regex[]">filtRegexes</span><span class="punctuation" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Regex>.Any<System.Text.RegularExpressions.Regex>(System.Func<System.Text.RegularExpressions.Regex, bool>)">.</span><span data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Regex>.Any<System.Text.RegularExpressions.Regex>(System.Func<System.Text.RegularExpressions.Regex, bool>)">Any</span> <span class="punctuation">(</span>re <span class="punctuation" data-toggle="tooltip" title="lambda expression">=&gt;</span> <span data-toggle="tooltip" title="System.Text.RegularExpressions.Regex">re</span><span class="punctuation" data-toggle="tooltip" title="System.Text.RegularExpressions.Regex.IsMatch(string)">.</span><span data-toggle="tooltip" title="System.Text.RegularExpressions.Regex.IsMatch(string)">IsMatch</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="LiterateCS.SplitPath">relPath</span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath.FilePath">FilePath</a></span><span class="punctuation">)</span><span class="punctuation">)</span> <span class="punctuation" data-toggle="tooltip" title="bool">&amp;&amp;</span>
						<span class="punctuation" data-toggle="tooltip" title="bool">!</span><span class="punctuation" data-toggle="tooltip" title="bool">(</span><span data-toggle="tooltip" title="LiterateCS.SplitPath">relPath</span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath.FilePath">FilePath</a></span><span class="punctuation" data-toggle="tooltip" title="string.EndsWith(string)">.</span><span data-toggle="tooltip" title="string.EndsWith(string)">EndsWith</span> <span class="punctuation">(</span><span class="string" data-toggle="tooltip" title="string">&quot;AssemblyAttributes.cs&quot;</span><span class="punctuation">)</span> <span class="punctuation" data-toggle="tooltip" title="bool">||</span>
						  <span data-toggle="tooltip" title="LiterateCS.SplitPath">relPath</span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath.FilePath">FilePath</a></span><span class="punctuation" data-toggle="tooltip" title="string.EndsWith(string)">.</span><span data-toggle="tooltip" title="string.EndsWith(string)">EndsWith</span> <span class="punctuation">(</span><span class="string" data-toggle="tooltip" title="string">&quot;AssemblyInfo.cs&quot;</span><span class="punctuation">)</span><span class="punctuation" data-toggle="tooltip" title="bool">)</span>
				   <span class="keyword" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<System.Tuple<LiterateCS.SplitPath, Microsoft.CodeAnalysis.Document>>">select</span> <span class="typename" data-toggle="tooltip" title="System.Tuple">Tuple</span><span class="punctuation" data-toggle="tooltip" title="System.Tuple.Create<LiterateCS.SplitPath, Microsoft.CodeAnalysis.Document>(LiterateCS.SplitPath, Microsoft.CodeAnalysis.Document)">.</span><span data-toggle="tooltip" title="System.Tuple.Create<LiterateCS.SplitPath, Microsoft.CodeAnalysis.Document>(LiterateCS.SplitPath, Microsoft.CodeAnalysis.Document)">Create</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="LiterateCS.SplitPath">relPath</span><span class="punctuation">,</span> <span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Document">doc</span><span class="punctuation">)</span><span class="punctuation">;</span>
		<span class="punctuation">}</span>
</code></pre>
<p>To get a Roslyn workspace, we use the Buildalyzer to build the solution in design
mode. This allows it work out all the depencies that need to be referenced in order
for the Roslyn compiler to succeed.</p>
<p>The BuildSolution method below uses Buildalyzer to first load a solution, and
then build each project separately. The build log can be optionally written
to a file, if the <code>--buildlog</code> option was given.</p>
<pre class="csharp"><code class="csharp">		<span class="keyword" id="LiterateCS.Weaver.BuildSolution()" data-toggle="tooltip" title="LiterateCS.Weaver.BuildSolution()">private</span> <span class="typename" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Solution">Solution</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.BuildSolution()">BuildSolution</span> <span class="punctuation">(</span><span class="punctuation">)</span>
		<span class="punctuation">{</span>
			<span class="keyword" data-toggle="tooltip" title="System.IO.TextWriter">var</span> <span id="logwriter">logwriter</span> <span class="punctuation">=</span> <span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/Options.html#LiterateCS.Options.BuildLog">BuildLog</a></span> <span class="punctuation" data-toggle="tooltip" title="bool">!=</span> <span class="keyword">null</span> <span class="punctuation" data-toggle="tooltip" title="System.IO.TextWriter">?</span>
				<span class="typename" data-toggle="tooltip" title="System.IO.File">File</span><span class="punctuation" data-toggle="tooltip" title="System.IO.File.CreateText(string)">.</span><span data-toggle="tooltip" title="System.IO.File.CreateText(string)">CreateText</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/Options.html#LiterateCS.Options.BuildLog">BuildLog</a></span><span class="punctuation">)</span> <span class="punctuation" data-toggle="tooltip" title="System.IO.TextWriter">:</span>
				<span class="typename" data-toggle="tooltip" title="System.IO.TextWriter">TextWriter</span><span class="punctuation" data-toggle="tooltip" title="System.IO.TextWriter">.</span><span data-toggle="tooltip" title="System.IO.TextWriter">Null</span><span class="punctuation">;</span>
			<span class="keyword">using</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="System.IO.TextWriter">logwriter</span><span class="punctuation">)</span>
			<span class="punctuation">{</span>
				<span class="keyword" data-toggle="tooltip" title="Buildalyzer.AnalyzerManager">var</span> <span id="amanager">amanager</span> <span class="punctuation">=</span> <span class="keyword" data-toggle="tooltip" title="Buildalyzer.AnalyzerManager">new</span> <span class="typename">AnalyzerManager</span> <span class="punctuation">(</span><span class="typename" data-toggle="tooltip" title="System.IO.Path">Path</span><span class="punctuation" data-toggle="tooltip" title="System.IO.Path.GetFullPath(string)">.</span><span data-toggle="tooltip" title="System.IO.Path.GetFullPath(string)">GetFullPath</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/Options.html#LiterateCS.Options.Solution">Solution</a></span><span class="punctuation">)</span><span class="punctuation">,</span>
					<span class="keyword" data-toggle="tooltip" title="Buildalyzer.AnalyzerManagerOptions">new</span> <span class="typename">AnalyzerManagerOptions</span> <span class="punctuation">(</span><span class="punctuation">)</span>
					<span class="punctuation">{</span>
						<span data-toggle="tooltip" title="System.IO.TextWriter">LogWriter</span> <span class="punctuation" data-toggle="tooltip" title="System.IO.TextWriter">=</span> <span data-toggle="tooltip" title="System.IO.TextWriter">logwriter</span>
					<span class="punctuation">}</span><span class="punctuation">)</span><span class="punctuation">;</span>
				<span data-toggle="tooltip" title="LiterateCS.Weaver.ConsoleOut(string, params object[])"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.ConsoleOut(string, object[])">ConsoleOut</a></span> <span class="punctuation">(</span><span class="string" data-toggle="tooltip" title="string">&quot;Building solution...&quot;</span><span class="punctuation">)</span><span class="punctuation">;</span>
				<span class="keyword" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Solution">var</span> solution <span class="punctuation">=</span> <span data-toggle="tooltip" title="Buildalyzer.AnalyzerManager">amanager</span><span class="punctuation" data-toggle="tooltip" title="Buildalyzer.AnalyzerManager.GetWorkspace()">.</span><span data-toggle="tooltip" title="Buildalyzer.AnalyzerManager.GetWorkspace()">GetWorkspace</span> <span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Solution">.</span><span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Solution">CurrentSolution</span><span class="punctuation">;</span>
				<span class="keyword">if</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/Options.html#LiterateCS.Options.BuildLog">BuildLog</a></span> <span class="punctuation" data-toggle="tooltip" title="bool">!=</span> <span class="keyword">null</span><span class="punctuation">)</span>
					<span data-toggle="tooltip" title="LiterateCS.Weaver.ConsoleOut(string, params object[])"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.ConsoleOut(string, object[])">ConsoleOut</a></span> <span class="punctuation">(</span><span class="string" data-toggle="tooltip" title="string">&quot;Build log written to {0}&quot;</span><span class="punctuation">,</span> <span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/Options.html#LiterateCS.Options.BuildLog">BuildLog</a></span><span class="punctuation">)</span><span class="punctuation">;</span>
				<span class="keyword">return</span> <span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Solution">solution</span><span class="punctuation">;</span>
			<span class="punctuation">}</span>
		<span class="punctuation">}</span>
</code></pre>
<p>Then we compile all the projects again, but this time using Roslyn. If there are
compilation errors, they will be outputted to the console.</p>
<pre class="csharp"><code class="csharp">		<span class="keyword" id="LiterateCS.Weaver.CompileProjectsInSolution(Microsoft.CodeAnalysis.Solution)" data-toggle="tooltip" title="LiterateCS.Weaver.CompileProjectsInSolution(Microsoft.CodeAnalysis.Solution)">public</span> <span class="typename" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Project>">IEnumerable</span><span class="punctuation">&lt;</span><span class="typename" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project">Project</span><span class="punctuation">&gt;</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.CompileProjectsInSolution(Microsoft.CodeAnalysis.Solution)">CompileProjectsInSolution</span> <span class="punctuation">(</span><span class="typename" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Solution">Solution</span> solution<span class="punctuation">)</span>
		<span class="punctuation">{</span>
			<span class="keyword">foreach</span> <span class="punctuation">(</span><span class="keyword" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project">var</span> proj <span class="keyword">in</span> <span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Solution">solution</span><span class="punctuation" data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Project>">.</span><span data-toggle="tooltip" title="System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Project>">Projects</span><span class="punctuation">)</span>
			<span class="punctuation">{</span>
				<span data-toggle="tooltip" title="LiterateCS.Weaver.ConsoleOut(string, params object[])"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.ConsoleOut(string, object[])">ConsoleOut</a></span> <span class="punctuation">(</span><span class="string" data-toggle="tooltip" title="string">&quot;Processing project {0}&quot;</span><span class="punctuation">,</span> <span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project">proj</span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string">Name</span><span class="punctuation">)</span><span class="punctuation">;</span>
				<span class="typename" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project">Project</span> <span id="p">p</span> <span class="punctuation">=</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.SuppressWarnings(Microsoft.CodeAnalysis.Project, params string[])"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.SuppressWarnings(Microsoft.CodeAnalysis.Project, string[])">SuppressWarnings</a></span> <span class="punctuation">(</span><span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project">proj</span><span class="punctuation">,</span> <span class="string" data-toggle="tooltip" title="string">&quot;CS1701&quot;</span><span class="punctuation">,</span> <span class="string" data-toggle="tooltip" title="string">&quot;CS8019&quot;</span><span class="punctuation">)</span><span class="punctuation">;</span>
				<span class="keyword" data-toggle="tooltip" title="System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic>">var</span> <span id="diag">diag</span> <span class="punctuation">=</span> <span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project">p</span><span class="punctuation" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project.GetCompilationAsync(System.Threading.CancellationToken)">.</span><span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project.GetCompilationAsync(System.Threading.CancellationToken)">GetCompilationAsync</span> <span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Compilation">.</span><span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Compilation">Result</span><span class="punctuation" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Compilation.GetDiagnostics(System.Threading.CancellationToken)">.</span><span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Compilation.GetDiagnostics(System.Threading.CancellationToken)">GetDiagnostics</span> <span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span>
				<span class="keyword">foreach</span> <span class="punctuation">(</span><span class="keyword" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Diagnostic">var</span> msg <span class="keyword">in</span> <span data-toggle="tooltip" title="System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostic>">diag</span><span class="punctuation">)</span>
					<span class="typename" data-toggle="tooltip" title="System.Console">Console</span><span class="punctuation" data-toggle="tooltip" title="System.IO.TextWriter">.</span><span data-toggle="tooltip" title="System.IO.TextWriter">Error</span><span class="punctuation" data-toggle="tooltip" title="System.IO.TextWriter.WriteLine(object)">.</span><span data-toggle="tooltip" title="System.IO.TextWriter.WriteLine(object)">WriteLine</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Diagnostic">msg</span><span class="punctuation">)</span><span class="punctuation">;</span>
				<span class="keyword">yield</span> <span class="keyword">return</span> <span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project">p</span><span class="punctuation">;</span>
			<span class="punctuation">}</span>
		<span class="punctuation">}</span>
</code></pre>
<p>To suppress some warnings that are caused by compiling against .NET Core
framework, we must set some compilation options for the project.</p>
<pre class="csharp"><code class="csharp">		<span class="keyword" id="LiterateCS.Weaver.SuppressWarnings(Microsoft.CodeAnalysis.Project, string[])" data-toggle="tooltip" title="LiterateCS.Weaver.SuppressWarnings(Microsoft.CodeAnalysis.Project, params string[])">private</span> <span class="keyword" data-toggle="tooltip" title="LiterateCS.Weaver.SuppressWarnings(Microsoft.CodeAnalysis.Project, params string[])">static</span> <span class="typename" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project">Project</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.SuppressWarnings(Microsoft.CodeAnalysis.Project, params string[])">SuppressWarnings</span> <span class="punctuation">(</span><span class="typename" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project">Project</span> proj<span class="punctuation">,</span> <span class="keyword">params</span> <span class="keyword" data-toggle="tooltip" title="string">string</span><span class="punctuation">[</span><span class="punctuation">]</span> warnings<span class="punctuation">)</span>
		<span class="punctuation">{</span>
			<span class="keyword" data-toggle="tooltip" title="System.Collections.Immutable.ImmutableDictionary<string, Microsoft.CodeAnalysis.ReportDiagnostic>">var</span> <span id="diagOpts">diagOpts</span> <span class="punctuation">=</span> <span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project">proj</span><span class="punctuation" data-toggle="tooltip" title="Microsoft.CodeAnalysis.CompilationOptions">.</span><span data-toggle="tooltip" title="Microsoft.CodeAnalysis.CompilationOptions">CompilationOptions</span><span class="punctuation" data-toggle="tooltip" title="System.Collections.Immutable.ImmutableDictionary<string, Microsoft.CodeAnalysis.ReportDiagnostic>">.</span><span data-toggle="tooltip" title="System.Collections.Immutable.ImmutableDictionary<string, Microsoft.CodeAnalysis.ReportDiagnostic>">SpecificDiagnosticOptions</span><span class="punctuation">;</span>
			<span class="keyword">for</span> <span class="punctuation">(</span><span class="keyword" data-toggle="tooltip" title="int">int</span> <span id="i">i</span> <span class="punctuation">=</span> <span class="number" data-toggle="tooltip" title="int">0</span><span class="punctuation">;</span> <span data-toggle="tooltip" title="int">i</span> <span class="punctuation" data-toggle="tooltip" title="bool">&lt;</span> <span data-toggle="tooltip" title="string[]">warnings</span><span class="punctuation" data-toggle="tooltip" title="int">.</span><span data-toggle="tooltip" title="int">Length</span><span class="punctuation">;</span> <span data-toggle="tooltip" title="int">i</span><span class="punctuation" data-toggle="tooltip" title="int">++</span><span class="punctuation">)</span>
				<span data-toggle="tooltip" title="System.Collections.Immutable.ImmutableDictionary<string, Microsoft.CodeAnalysis.ReportDiagnostic>">diagOpts</span> <span class="punctuation" data-toggle="tooltip" title="System.Collections.Immutable.ImmutableDictionary<string, Microsoft.CodeAnalysis.ReportDiagnostic>">=</span> <span data-toggle="tooltip" title="System.Collections.Immutable.ImmutableDictionary<string, Microsoft.CodeAnalysis.ReportDiagnostic>">diagOpts</span><span class="punctuation" data-toggle="tooltip" title="System.Collections.Immutable.ImmutableDictionary<string, Microsoft.CodeAnalysis.ReportDiagnostic>.Add(string, Microsoft.CodeAnalysis.ReportDiagnostic)">.</span><span data-toggle="tooltip" title="System.Collections.Immutable.ImmutableDictionary<string, Microsoft.CodeAnalysis.ReportDiagnostic>.Add(string, Microsoft.CodeAnalysis.ReportDiagnostic)">Add</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="string[]">warnings</span><span class="punctuation">[</span><span data-toggle="tooltip" title="int">i</span><span class="punctuation">]</span><span class="punctuation">,</span> <span class="typename" data-toggle="tooltip" title="Microsoft.CodeAnalysis.ReportDiagnostic">ReportDiagnostic</span><span class="punctuation" data-toggle="tooltip" title="Microsoft.CodeAnalysis.ReportDiagnostic">.</span><span data-toggle="tooltip" title="Microsoft.CodeAnalysis.ReportDiagnostic">Suppress</span><span class="punctuation">)</span><span class="punctuation">;</span>
			<span class="keyword">return</span> <span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project">proj</span><span class="punctuation" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project.WithCompilationOptions(Microsoft.CodeAnalysis.CompilationOptions)">.</span><span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project.WithCompilationOptions(Microsoft.CodeAnalysis.CompilationOptions)">WithCompilationOptions</span> <span class="punctuation">(</span>
				<span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Project">proj</span><span class="punctuation" data-toggle="tooltip" title="Microsoft.CodeAnalysis.CompilationOptions">.</span><span data-toggle="tooltip" title="Microsoft.CodeAnalysis.CompilationOptions">CompilationOptions</span><span class="punctuation" data-toggle="tooltip" title="Microsoft.CodeAnalysis.CompilationOptions.WithSpecificDiagnosticOptions(System.Collections.Immutable.ImmutableDictionary<string, Microsoft.CodeAnalysis.ReportDiagnostic>)">.</span><span data-toggle="tooltip" title="Microsoft.CodeAnalysis.CompilationOptions.WithSpecificDiagnosticOptions(System.Collections.Immutable.ImmutableDictionary<string, Microsoft.CodeAnalysis.ReportDiagnostic>)">WithSpecificDiagnosticOptions</span> <span class="punctuation">(</span><span data-toggle="tooltip" title="System.Collections.Immutable.ImmutableDictionary<string, Microsoft.CodeAnalysis.ReportDiagnostic>">diagOpts</span><span class="punctuation">)</span><span class="punctuation">)</span><span class="punctuation">;</span>
		<span class="punctuation">}</span>
</code></pre>
<p>The following three helper functions construct a block list from a markdown file,
source file or Roslyn document. They are used by the subclasses.</p>
<pre class="csharp"><code class="csharp">		<span class="keyword" id="LiterateCS.Weaver.BlockListFromMarkdown(string)" data-toggle="tooltip" title="LiterateCS.Weaver.BlockListFromMarkdown(string)">protected</span> <span class="typename" data-toggle="tooltip" title="LiterateCS.BlockList"><a href="../LiterateCS/BlockList.html#LiterateCS.BlockList">BlockList</a></span> <span data-toggle="tooltip" title="LiterateCS.Weaver.BlockListFromMarkdown(string)">BlockListFromMarkdown</span> <span class="punctuation">(</span><span class="keyword" data-toggle="tooltip" title="string">string</span> mdFile<span class="punctuation">)</span> <span class="punctuation">=&gt;</span>
			<span data-toggle="tooltip" title="LiterateCS.Weaver.CreateBlockBuilder()"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.CreateBlockBuilder()">CreateBlockBuilder</a></span> <span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.BlockBuilder.FromMdFile(string)">.</span><span data-toggle="tooltip" title="LiterateCS.BlockBuilder.FromMdFile(string)"><a href="../LiterateCS/BlockBuilder.html#LiterateCS.BlockBuilder.FromMdFile(string)">FromMdFile</a></span> <span class="punctuation">(</span><span data-toggle="tooltip" title="string">mdFile</span><span class="punctuation">)</span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.Weaver.BlockListFromMarkdown(string)">;</span>

		<span class="keyword" id="LiterateCS.Weaver.BlockListFromCode(string)" data-toggle="tooltip" title="LiterateCS.Weaver.BlockListFromCode(string)">protected</span> <span class="typename" data-toggle="tooltip" title="LiterateCS.BlockList"><a href="../LiterateCS/BlockList.html#LiterateCS.BlockList">BlockList</a></span> <span data-toggle="tooltip" title="LiterateCS.Weaver.BlockListFromCode(string)">BlockListFromCode</span> <span class="punctuation">(</span><span class="keyword" data-toggle="tooltip" title="string">string</span> codeFile<span class="punctuation">)</span> <span class="punctuation">=&gt;</span>
			<span data-toggle="tooltip" title="LiterateCS.Weaver.CreateBlockBuilder()"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.CreateBlockBuilder()">CreateBlockBuilder</a></span> <span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.BlockBuilder.FromCodeFile(string)">.</span><span data-toggle="tooltip" title="LiterateCS.BlockBuilder.FromCodeFile(string)"><a href="../LiterateCS/BlockBuilder.html#LiterateCS.BlockBuilder.FromCodeFile(string)">FromCodeFile</a></span> <span class="punctuation">(</span><span data-toggle="tooltip" title="string">codeFile</span><span class="punctuation">)</span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.Weaver.BlockListFromCode(string)">;</span>

		<span class="keyword" id="LiterateCS.Weaver.BlockListFromDocument(Microsoft.CodeAnalysis.Document)" data-toggle="tooltip" title="LiterateCS.Weaver.BlockListFromDocument(Microsoft.CodeAnalysis.Document)">protected</span> <span class="typename" data-toggle="tooltip" title="LiterateCS.BlockList"><a href="../LiterateCS/BlockList.html#LiterateCS.BlockList">BlockList</a></span> <span data-toggle="tooltip" title="LiterateCS.Weaver.BlockListFromDocument(Microsoft.CodeAnalysis.Document)">BlockListFromDocument</span> <span class="punctuation">(</span><span class="typename" data-toggle="tooltip" title="Microsoft.CodeAnalysis.Document">Document</span> document<span class="punctuation">)</span> <span class="punctuation">=&gt;</span>
			<span data-toggle="tooltip" title="LiterateCS.Weaver.CreateBlockBuilder()"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver.CreateBlockBuilder()">CreateBlockBuilder</a></span> <span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.BlockBuilder.FromDocument(Microsoft.CodeAnalysis.Document)">.</span><span data-toggle="tooltip" title="LiterateCS.BlockBuilder.FromDocument(Microsoft.CodeAnalysis.Document)"><a href="../LiterateCS/BlockBuilder.html#LiterateCS.BlockBuilder.FromDocument(Microsoft.CodeAnalysis.Document)">FromDocument</a></span> <span class="punctuation">(</span><span data-toggle="tooltip" title="Microsoft.CodeAnalysis.Document">document</span><span class="punctuation">)</span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.Weaver.BlockListFromDocument(Microsoft.CodeAnalysis.Document)">;</span>
</code></pre>
<p>Finally we need some helper functions to determine the type of a file. The
type of a file is deduced from its extension or from its name.</p>
<pre class="csharp"><code class="csharp">		<span class="keyword" id="LiterateCS.Weaver.IsSourceFile(LiterateCS.SplitPath)" data-toggle="tooltip" title="LiterateCS.Weaver.IsSourceFile(LiterateCS.SplitPath)">protected</span> <span class="keyword" data-toggle="tooltip" title="bool">bool</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.IsSourceFile(LiterateCS.SplitPath)">IsSourceFile</span> <span class="punctuation">(</span><span class="typename" data-toggle="tooltip" title="LiterateCS.SplitPath"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath">SplitPath</a></span> file<span class="punctuation">)</span> <span class="punctuation">=&gt;</span>
			<span data-toggle="tooltip" title="LiterateCS.SplitPath">file</span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath.Extension">Extension</a></span> <span class="punctuation" data-toggle="tooltip" title="bool">==</span> <span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/Options.html#LiterateCS.Options.SourceExt">SourceExt</a></span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.Weaver.IsSourceFile(LiterateCS.SplitPath)">;</span>

		<span class="keyword" id="LiterateCS.Weaver.IsMarkdownFile(LiterateCS.SplitPath)" data-toggle="tooltip" title="LiterateCS.Weaver.IsMarkdownFile(LiterateCS.SplitPath)">protected</span> <span class="keyword" data-toggle="tooltip" title="bool">bool</span> <span data-toggle="tooltip" title="LiterateCS.Weaver.IsMarkdownFile(LiterateCS.SplitPath)">IsMarkdownFile</span> <span class="punctuation">(</span><span class="typename" data-toggle="tooltip" title="LiterateCS.SplitPath"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath">SplitPath</a></span> file<span class="punctuation">)</span> <span class="punctuation">=&gt;</span>
			<span data-toggle="tooltip" title="LiterateCS.SplitPath">file</span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/SplitPath.html#LiterateCS.SplitPath.Extension">Extension</a></span> <span class="punctuation" data-toggle="tooltip" title="bool">==</span> <span data-toggle="tooltip" title="LiterateCS.Options"><a href="../LiterateCS/Weaver.html#LiterateCS.Weaver._options">_options</a></span><span class="punctuation" data-toggle="tooltip" title="string">.</span><span data-toggle="tooltip" title="string"><a href="../LiterateCS/Options.html#LiterateCS.Options.MarkdownExt">MarkdownExt</a></span><span class="punctuation" data-toggle="tooltip" title="LiterateCS.Weaver.IsMarkdownFile(LiterateCS.SplitPath)">;</span>
	<span class="punctuation">}</span>
<span class="punctuation">}</span>
</code></pre>

				</div>
				<ul class="pager">
	<li class="previous"><a href="../LiterateCS/SplitPath.html">Previous: SplitPath Structure</a></li>
	<li class="next"><a href="../LiterateCS/MdWeaver.html">Next: Markdown Weaver</a></li>
</ul>
			</div>
        </div>
    </div>
    
    <footer class="panel-footer text-center">
        <div align="center">Copyright © 2018 Tommi Johtela</div>
		<div align="right">
			<small>
				Documentation created with <a href="https://johtela.github.io/LiterateCS/">LiterateCS</a>.
			</small>
		</div>
    </footer>


    
    <script src="../bootstrap/js/jquery.min.js"></script>
    <script src="../bootstrap/js/bootstrap.min.js"></script>
    <script src="../sidebar/sidebar.js"></script>
    <script src="../syntax-highlight/syntax.js"></script>
    <script type="text/x-mathjax-config">
        MathJax.Hub.Config({
        extensions: ["jsMath2jax.js"]
        });
    </script>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML'></script>
	<script src="../mermaid/mermaid.min.js"></script>
	<script>mermaid.initialize({startOnLoad:true});</script>

</body>
</html>